GCancellable *cancellable,
GError **error)
{
- gboolean ret = FALSE;
- g_autoptr(GPtrArray) path_parts = g_ptr_array_new ();
- g_autoptr(GFileInfo) root_info = NULL;
- root_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- cancellable, error);
+ g_autoptr(GFileInfo) root_info =
+ g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ cancellable, error);
if (!root_info)
- goto out;
+ return FALSE;
+ g_autoptr(GPtrArray) path_parts = g_ptr_array_new ();
g_ptr_array_add (path_parts, (char*)prefix);
if (!relabel_recursively (sysroot, sepolicy, dir, root_info, path_parts,
cancellable, error))
- {
- g_prefix_error (error, "Relabeling /%s: ", prefix);
- goto out;
- }
+ return glnx_prefix_error (error, "Relabeling /%s", prefix);
- ret = TRUE;
- out:
- return ret;
+ return TRUE;
}
/* Handles SELinux labeling for /var; this is slated to be deleted. See
if (previous_deployment)
{
- g_autoptr(GFile) previous_path = NULL;
- OstreeBootconfigParser *previous_bootconfig;
-
- previous_path = ostree_sysroot_get_deployment_directory (sysroot, previous_deployment);
-
- previous_bootconfig = ostree_deployment_get_bootconfig (previous_deployment);
+ OstreeBootconfigParser *previous_bootconfig = ostree_deployment_get_bootconfig (previous_deployment);
if (previous_bootconfig)
{
const char *previous_options = ostree_bootconfig_parser_get (previous_bootconfig, "options");
return FALSE;
{
+ /* We checksum the kernel arguments *except* ostree= */
OstreeBootconfigParser *a_bootconfig = ostree_deployment_get_bootconfig (a);
- OstreeBootconfigParser *b_bootconfig = ostree_deployment_get_bootconfig (b);
const char *a_boot_options = ostree_bootconfig_parser_get (a_bootconfig, "options");
- const char *b_boot_options = ostree_bootconfig_parser_get (b_bootconfig, "options");
- g_autoptr(OstreeKernelArgs) a_kargs = NULL;
- g_autoptr(OstreeKernelArgs) b_kargs = NULL;
- g_autofree char *a_boot_options_without_ostree = NULL;
- g_autofree char *b_boot_options_without_ostree = NULL;
-
- /* We checksum the kernel arguments *except* ostree= */
- a_kargs = _ostree_kernel_args_from_string (a_boot_options);
+ g_autoptr(OstreeKernelArgs) a_kargs = _ostree_kernel_args_from_string (a_boot_options);
_ostree_kernel_args_replace (a_kargs, "ostree");
- a_boot_options_without_ostree = _ostree_kernel_args_to_string (a_kargs);
+ g_autofree char *a_boot_options_without_ostree = _ostree_kernel_args_to_string (a_kargs);
- b_kargs = _ostree_kernel_args_from_string (b_boot_options);
+ OstreeBootconfigParser *b_bootconfig = ostree_deployment_get_bootconfig (b);
+ const char *b_boot_options = ostree_bootconfig_parser_get (b_bootconfig, "options");
+ g_autoptr(OstreeKernelArgs) b_kargs = _ostree_kernel_args_from_string (b_boot_options);
_ostree_kernel_args_replace (b_kargs, "ostree");
- b_boot_options_without_ostree = _ostree_kernel_args_to_string (b_kargs);
+ g_autofree char *b_boot_options_without_ostree = _ostree_kernel_args_to_string (b_kargs);
if (strcmp (a_boot_options_without_ostree, b_boot_options_without_ostree) != 0)
return FALSE;
GError **error)
{
gboolean ret = FALSE;
- guint i;
- gboolean requires_new_bootversion = FALSE;
- gboolean found_booted_deployment = FALSE;
- gboolean bootloader_is_atomic = FALSE;
gboolean boot_was_ro_mount = FALSE;
- SyncStats syncstats = { 0, };
g_autoptr(OstreeBootloader) bootloader = NULL;
g_assert (self->loaded);
* matching bootloader configuration, then we can just swap the
* subbootversion bootlinks.
*/
+ gboolean requires_new_bootversion = FALSE;
if (new_deployments->len != self->deployments->len)
requires_new_bootversion = TRUE;
else
{
- for (i = 0; i < new_deployments->len; i++)
+ for (guint i = 0; i < new_deployments->len; i++)
{
if (!deployment_bootconfigs_equal (new_deployments->pdata[i],
self->deployments->pdata[i]))
}
}
- for (i = 0; i < new_deployments->len; i++)
+ gboolean found_booted_deployment = FALSE;
+ for (guint i = 0; i < new_deployments->len; i++)
{
OstreeDeployment *deployment = new_deployments->pdata[i];
g_autoptr(GFile) deployment_root = NULL;
goto out;
}
+ gboolean bootloader_is_atomic = FALSE;
+ SyncStats syncstats = { 0, };
if (!requires_new_bootversion)
{
if (!create_new_bootlinks (self, self->bootversion,
/* Only show the osname in bootloader titles if there are multiple
* osname's among the new deployments. Check for that here. */
- for (i = 1; i < new_deployments->len; i++)
+ for (guint i = 1; i < new_deployments->len; i++)
{
- const gchar *osname_0, *osname_i;
-
- osname_0 = ostree_deployment_get_osname (new_deployments->pdata[0]);
- osname_i = ostree_deployment_get_osname (new_deployments->pdata[i]);
-
+ const char *osname_0 = ostree_deployment_get_osname (new_deployments->pdata[0]);
+ const char *osname_i = ostree_deployment_get_osname (new_deployments->pdata[i]);
if (!g_str_equal (osname_0, osname_i))
{
show_osname = TRUE;
}
}
- for (i = 0; i < new_deployments->len; i++)
+ for (guint i = 0; i < new_deployments->len; i++)
{
OstreeDeployment *deployment = new_deployments->pdata[i];
if (!install_deployment_kernel (self, repo, new_bootversion,
return TRUE;
}
+/* Given a bootloader config, return the value part of the ostree= kernel
+ * argument.
+ */
static char *
get_ostree_kernel_arg_from_config (OstreeBootconfigParser *config)
{
- const char *options;
- char *ret = NULL;
- char **opts, **iter;
-
- options = ostree_bootconfig_parser_get (config, "options");
+ const char *options = ostree_bootconfig_parser_get (config, "options");
if (!options)
return NULL;
- opts = g_strsplit (options, " ", -1);
- for (iter = opts; *iter; iter++)
+ g_auto(GStrv) opts = g_strsplit (options, " ", -1);
+ for (char **iter = opts; *iter; iter++)
{
const char *opt = *iter;
if (g_str_has_prefix (opt, "ostree="))
- {
- ret = g_strdup (opt + strlen ("ostree="));
- break;
- }
+ return g_strdup (opt + strlen ("ostree="));
}
- g_strfreev (opts);
- return ret;
+ return NULL;
}
static gboolean
GPtrArray *
ostree_sysroot_get_deployments (OstreeSysroot *self)
{
- GPtrArray *copy;
- guint i;
-
g_return_val_if_fail (self->loaded, NULL);
- copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
- for (i = 0; i < self->deployments->len; i++)
+ GPtrArray *copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
+ for (guint i = 0; i < self->deployments->len; i++)
g_ptr_array_add (copy, g_object_ref (self->deployments->pdata[i]));
return copy;
}
_ostree_sysroot_join_lines (GPtrArray *lines)
{
GString *buf = g_string_new ("");
- guint i;
gboolean prev_was_empty = FALSE;
- for (i = 0; i < lines->len; i++)
+ for (guint i = 0; i < lines->len; i++)
{
const char *line = lines->pdata[i];
/* Special bit to remove extraneous empty lines */